<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('构建证书主题')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
 	<form class="form-horizontal m" id="form-buildSubject">
        <div class="form-group">	
            <label class="col-sm-3 control-label is-required">CN：</label>
            <div class="col-sm-8">
                <input id="cn" name="cn" class="form-control" type="text" required>
            </div>
        </div>
         <div class="form-group">	
            <label class="col-sm-3 control-label">O：</label>
            <div class="col-sm-8">
                <input id="o" name="o" class="form-control" type="text">
            </div>
        </div>
        
          <div class="form-group">	
            <label class="col-sm-3 control-label">OU：</label>
            <div class="col-sm-8">
                <input id="ou" name="ou" class="form-control" type="text" >
            </div>
        </div>
         <div class="form-group">	
            <label class="col-sm-3 control-label">L：</label>
            <div class="col-sm-8">
                <input id="l" name="l" class="form-control" type="text" >
            </div>
        </div>
        
         <div class="form-group">	
            <label class="col-sm-3 control-label">S：</label>
            <div class="col-sm-8">
                <input id="s" name="s" class="form-control" type="text" >
            </div>
        </div>
        
          <div class="form-group">	
            <label class="col-sm-3 control-label is-required">C：</label>
            <div class="col-sm-8">
                <input id="c" name="c" class="form-control" type="text" required>
            </div>
        </div>
        
    </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
    
    $("#form-buildSubject").validate({
    	onkeyup: false,
        rules: {
            cn: {
            	
            },c: {
            	
            }
        },
        messages: {
            
        },
        focusCleanup: true
    });
    
    function submitHandler() {
    	  var parent = activeWindow();
    	if ($.validate.form()) {
    		 var cn = $("#cn").val();
    	     var o = $("#o").val();
    	     var ou = $("#ou").val();
    	     var l = $("#l").val();
    	     var s = $("#s").val();
    	     var c = $("#c").val();
    	       
    	     var subjectDn = "CN="+cn;
    	     if(o!=null && o!=''){
    	    	 subjectDn+=",O="+o;
    	     }else if(ou!=null && ou!=''){
    	    	 subjectDn+=",OU="+ou;
    	     }else if(l!=null && l!=''){
    	    	 subjectDn+=",L="+l;
    	     }else if(s!=null && s!=''){
    	    	 subjectDn+=",S="+s;
    	     }
    	     subjectDn+=",C="+c;
    	     console.log(parent)
    	     parent.$("#subjectDn").val(subjectDn);
    	     console.log(parent.$("#subjectDn").val())
    	     $.modal.close();
        }
      
    }
	    
    </script>
</body>
</html>
